package com.module.dialog;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;

/**
 * Author: deng
 * Date: 2020/10/20
 * Description: 自定义对话框-对话框内容布局
 */
public class CustomDialog extends BaseBuilder<CustomDialog> implements View.OnClickListener {


    public CustomDialog(Context context) {
        super(context);
    }

    @Override
    public CustomDialog getBuilder() {
        return this;
    }

    /**
     * 初始化控件
     */
    @Override
    public void initContentView() {

    }

    public CustomDialog setContentView(IContentView iContentView){
        if(iContentView.getLayoutRes() != 0){
            View contentView = LayoutInflater.from(mContext).inflate(iContentView.getLayoutRes(), null);
            iContentView.bindDatas(contentView);
            setContentView(contentView);
        }
        return this;
    }

    @Override
    protected void connectView() {
    }

    public interface IContentView{
        int getLayoutRes();
        void bindDatas(View parent);
    }
}